﻿namespace DomainServices.Tools
{
    using System;
    using System.ComponentModel.Composition;

    [AttributeUsage(AttributeTargets.Class, AllowMultiple=false), MetadataAttribute]
    public sealed class DomainServiceClientCodeGeneratorAttribute : ExportAttribute, ICodeGeneratorMetadata
    {
        private string _generatorName;
        private string _language;

        public DomainServiceClientCodeGeneratorAttribute(string generatorName, string language) : base(typeof(IDomainServiceClientCodeGenerator))
        {
            this._generatorName = generatorName;
            this._language = language;
        }

        public DomainServiceClientCodeGeneratorAttribute(Type generatorType, string language) : this((generatorType != null) ? generatorType.FullName : string.Empty, language)
        {
        }

        public string GeneratorName
        {
            get
            {
                return this._generatorName;
            }
        }

        public string Language
        {
            get
            {
                return this._language;
            }
        }
    }
}

